class Ten:
    name = 'ten'
    age = 18

    # 类属性不会添加到 self.__dict__中

    def __init__(self):
        self.gender = 'male'  # 对象属性

    def keys(self):
        return ('name', 'age', 'gender')

    def __getitem__(self, item):
        # return '1000'
        return getattr(self, item)


# r = {'name': 'ten', 'age': 18}
# print(r)
#
# r1 = dict(name='ten', age=18)
# print(r1)
#
#
# ten = Ten()
# print(ten.__dict__)


ten = Ten()
print(dict(ten))  # key value

# ten['name']
# ten['age']
